import request from './request'

/**
 * 请求一级分类列表
 */
export const queryTopCategories = () => {
  return request.get('/category/top')
}
/**
 * 根据一级分类id请求二级分类
 */
export const querySecondaryCategories = (id) => {
  return request.get(`/category/secondary?id=${id}`)
}
/**
 * 根据二级分类id请求三级分类
 */
export const queryTertiaryCategories = (id) => {
  return request.get(`/category/tertiary?id=${id}`)
}

export const queryComprehensiveCategoryList = (id) => {
  return request.get(`/category/show?id=${id}`)
}
/**
 * 查询商品列表
 * @param {*} categoryId 
 * @param {*} orderBy 
 * @param {*} priceOrder 
 * @param {*} page 
 * @param {*} pageSize 
 */
export const queryProductListConditionalByCategoryId = (categoryId, orderBy, priceOrder, page, pageSize) => {
  return request
    .get(`/category/list/product?categoryId=${categoryId}&orderBy=${orderBy}&priceOrder=${priceOrder}&page=${page}&pageSize=${pageSize}`)
}